//
//  SelectWorkCollectionViewCell.m
//  fitnessmanage
//
//  Created by wujian on 2017/12/14.
//  Copyright © 2017年 zongquankeji. All rights reserved.
//

#import "SelectWorkCollectionViewCell.h"

@implementation SelectWorkCollectionViewCell

-(id)initWithFrame:(CGRect)frame{
    
    self = [super initWithFrame:frame];
    
    if (self) {
        
        UIImageView *headImageView = [[UIImageView alloc] init];
        headImageView.layer.cornerRadius = 30;
        headImageView.layer.masksToBounds = YES;
        headImageView.image = PlaceHold;
        headImageView.contentMode = UIViewContentModeScaleAspectFill;
        [self addSubview:headImageView];
        self.headImageView = headImageView;
        
        UILabel *nameLabel = [[UILabel alloc] init];
        nameLabel.font = MidFont;
        nameLabel.text = @"阿静";
        nameLabel.textColor = CSColorFromRGB(0x0a0a0a);
        [self addSubview:nameLabel];
        self.nameLabel = nameLabel;
        
        UIButton *checkBtn = [[UIButton alloc] init];
        checkBtn.userInteractionEnabled = YES;
        [checkBtn setImage:@"icon_mchose_none"];
        [checkBtn setSelectedImage:@"icon_mchose"];
        [self addSubview:checkBtn];
        self.checkBtn = checkBtn;
        
        [self setConstraints];
    }
    
    return self;
}

-(void)setConstraints{
    
    [self.headImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
       
        make.centerX.mas_equalTo(self);
        
        make.top.mas_equalTo(self).offset(10);
        
        make.height.width.mas_equalTo(60);
    }];
    
    [self.nameLabel mas_remakeConstraints:^(MASConstraintMaker *make) {

        make.top.mas_equalTo(self.headImageView.mas_bottom).offset(10);

        make.centerX.mas_equalTo(self);
    }];

    [self.checkBtn mas_remakeConstraints:^(MASConstraintMaker *make) {

        make.bottom.mas_equalTo(self.headImageView);

        make.centerX.mas_equalTo(self.headImageView.mas_right).offset(-3);
    }];
}

-(void)setIsSelect:(BOOL)isSelect{
    
    if (isSelect) {
        
        self.checkBtn.selected = YES;
    }
    else{
        
        self.checkBtn.selected = NO;
    }
}
@end
